<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- <link rel="icon" href="/static/favicon.png?v=2" type="image/x-icon" /> -->
    <title>Atx Report</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css">
    <!-- 
  <link rel="stylesheet" href="http://gohttp.nie.netease.com/qard-libs/libs/bootstrap/3.3.5/css/bootstrap.min.css">
  <link rel="stylesheet" href="http://gohttp.nie.netease.com/qard-libs/libs/fancybox/2.1.5/jquery.fancybox.min.css">
  <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
  -->
    <style>
      body {
        padding-top: 70px;
      }
      
      .info-name {
        padding-right: 1em;
        display: inline-block;
        width: 7em;
        font-family: 'Courier New';
        font-weight: 700;
      }
      
      ul.device-info {
        padding-left: 10px;
      }
      
      ul.device-info>li {
        list-style-type: none;
      }
      
      div.image-wrapper {
        position: relative;
        overflow: hidden;
        max-width: 300px;
        margin: 0 auto;
      }
      
      .image-wrapper>img {
        border: 1px solid black;
      }
      
      span.positioner {
        position: absolute;
        display: block;
      }
      
      span.finger {
        position: absolute;
        display: block;
        border-radius: 50%;
        width: 8mm;
        height: 8mm;
        top: -4mm;
        left: -4mm;
        pointer-events: none;
        border-width: 1px;
        border-color: #464646;
        opacity: 0.5;
        background-color: red;
      }
      
      .halfsize {
        -moz-transform: scale(0.5);
        -webkit-transform: scale(0.5);
        transform: scale(0.5);
      }
      
      a.anchor {
        display: block;
        position: relative;
        top: -70px;
        visibility: hidden;
        width: 0px;
        height: 0px;
      }
      
      span.success {
        color: white;
        background-color: green;
        padding: 3px;
      }
      
      span.failure {
        color: white;
        background-color: red;
        padding: 3px;
      }
      
      .color-green {
        color: green;
      }
      
      .color-red {
        color: red;
      }
      
      .table-image {
        max-height: 200px;
      }
      
      a.thumbnail {
        margin-bottom: 0px;
      }
      
      .code-font {
        font-family: "Courier New";
      }
      
      .nav-badge {
        margin: 15px 1px;
        line-height: 20px;
        width: 20px;
        text-align: center;
        border-radius: 10px;
        display: inline-block;
        color: white;
        background-color: green;
      }
    </style>
  </head>

  <body>
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">ATX Report</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
              列表 <span class="caret"></span>
            </a>
              <ul class="dropdown-menu" role="menu">
                <li v-for="step in steps">
                  <a href="#{{step.time}}">{{step.time}} {{step.action}}  {{step.description}}</a>
                </li>
              </ul>
            </li>
            <li><a href="#"><strong>登录测试</strong></a></li>
          </ul>
          <span class="nav-badge">1</span>
          <span class="nav-badge">2</span>
        </div>
      </div>
    </nav>
    <div class="container" id="app">
      <div class="row">
        <div class="col-md-12">
          <div class="panel panel-default">
            <div class="panel-body">
              <span class="glyphicon glyphicon-ok color-green"></span> 2
              <span class="glyphicon glyphicon-remove color-red"></span> 1 总耗时3min
            </div>
            <table class="table table-hover table-condensed">
              <thead>
                <th>编号</th>
                <th>标题</th>
                <th>结果</th>
                <th>耗时</th>
              </thead>
              <tbody>
                <tr>
                  <td style="width: 4em">1</td>
                  <td>登录测试</td>
                  <td><span class="glyphicon glyphicon-ok color-green"></span></td>
                  <td>1 min</td>
                </tr>
                <tr>
                  <td>1</td>
                  <td>登录测试</td>
                  <td><span class="glyphicon glyphicon-remove color-red"></span></td>
                  <td>2 min</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>

        <div class="col-md-12">
          <div class="panel" :class="v.success ? 'panel-success' : 'panel-danger'" v-for="(v, index) in cases">
            <div class="panel-heading">
              No.{{index+1}} {{v.name}} <span class="glyphicon glyphicon-ok color-red"></span>
            </div>
            <table class="table table-hover table-condensed">
              <tbody>
                <tr v-for="(step, index) in v.steps">
                  <td style="width: 3em" class="text-center">{{index+1}}</td>
                  <td>{{step.title}}</td>
                  <td>
                    <a href="#" class="thumbnail">
                      <img :src="step.screenshot" alt="before" class="table-image" />
                      <div class="text-center" style="font-size: 9px">BeginAt: 20:00:01</div>
                    </a>
                  </td>
                  <td>
                    <a href="#" class="thumbnail">
                      <img :src="step.screenshot" alt="after" class="table-image" />
                    </a>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <blockquote class="code-font">
        <p>Make mobile test automated, free testers from endless work.</p>
        <footer>Powered by
          <a href="https://github.com/NetEaseGame/AutomatorX">
            <cite title="Short for AutomatorX">ATX</cite>
          </a>
        </footer>
      </blockquote>
    </div>
  </body>
  <script src="https://cdn.jsdelivr.net/jquery/1.11.3/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
  <script src="https://cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.pack.js"></script>
  <script src="https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/vue/2.3.2/vue.min.js"></script>
  <!--
<script src="http://gohttp.nie.netease.com/qard-libs/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://gohttp.nie.netease.com/qard-libs/libs/mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
<script src="http://gohttp.nie.netease.com/qard-libs/libs/fancybox/2.1.5/jquery.fancybox.pack.js"></script>
<script src="http://gohttp.nie.netease.com/qard-libs/libs/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://gohttp.nie.netease.com/qard-libs/libs/vue/1.0.22/vue.min.js"></script>
-->
  <!-- <script src="//cdn.rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script> -->
  <script>
    $(function() {
      $(".panel-heading").on('click', function() {
        $(this).next().toggle();
      })

      var json;
      try {
        json = $$data$$;
      } catch (ReferenceError) {
        console.log("Load test data");
        json = {
          phone: {
            deviceUri: 'unknown',
            name: '',
            display: '200x300',
          },
          beginAt: '2017/06/01',
          finishAt: '2018/06/01',
          duration: 20000, // ms
          cases: [{
            name: '登录测试',
            success: false,
            beginAt: '2017/06/01',
            finishAt: '2017/07/01',
            duration: '3 minutes',
            steps: [{
              title: '输入用户名',
              success: true,
              screenshot: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
            }, {
              title: '输入密码',
              success: false,
              screenshotBefore: '',
              screenshotAfter: 'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
            }]
          }]
        }
      }

      Vue.filter('displayPosition', function(pos) {
        var x = (pos.x * 100 / this.device.display.width).toFixed(2) + '%';
        var y = (pos.y * 100 / this.device.display.height).toFixed(2) + '%';
        return "left: " + x + "; top: " + y + ";"
      })

      Vue.filter('translate', function(text) {
        return {
          assert_image_exists: '验证图片存在',
          click_image: '点击图片',
          assert: '验证',
          info: '>>'
        }[text] || text;
      })

      Vue.nextTick(function() {
        $(".fancybox").fancybox()
      })

      new Vue({
        el: '#app',
        data: json,
        computed: {
          // step_count: function() {
          //   return this.steps.length;
          // },
          // test_result: function() {
          //   return !this.steps.some(function(v) {
          //     return v.success === false
          //   })
          // }
        }
      })

    })
  </script>

</html>